within ThermoSysPro.Examples.SimpleExamples;
model TestJunctions
  ThermoSysPro.WaterSteam.Junctions.Splitter2 splitter2 annotation(Placement(transformation(x=-10.0, y=50.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.WaterSteam.BoundaryConditions.SourceQ sourceP(Q0=200) annotation(Placement(transformation(x=-90.0, y=50.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.WaterSteam.PressureLosses.SingularPressureLoss singularPressureLoss annotation(Placement(transformation(x=-50.0, y=50.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  annotation(Diagram);
  ThermoSysPro.WaterSteam.BoundaryConditions.Sink sinkP annotation(Placement(transformation(x=90.0, y=90.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.WaterSteam.BoundaryConditions.SinkP sinkP1 annotation(Placement(transformation(x=90.0, y=10.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.WaterSteam.PressureLosses.SingularPressureLoss singularPressureLoss1 annotation(Placement(transformation(x=50.0, y=90.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.WaterSteam.PressureLosses.SingularPressureLoss singularPressureLoss2 annotation(Placement(transformation(x=50.0, y=10.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante constante(k=0.5) annotation(Placement(transformation(x=-30.0, y=70.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.WaterSteam.Junctions.Splitter3 splitter3 annotation(Placement(transformation(x=-10.0, y=-50.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.WaterSteam.BoundaryConditions.SourceQ sourceP1(Q0=400) annotation(Placement(transformation(x=-90.0, y=-50.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.WaterSteam.PressureLosses.SingularPressureLoss singularPressureLoss3 annotation(Placement(transformation(x=-50.0, y=-50.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.WaterSteam.BoundaryConditions.Sink sinkP2 annotation(Placement(transformation(x=90.0, y=-10.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.WaterSteam.BoundaryConditions.Sink sinkP3 annotation(Placement(transformation(x=90.0, y=-90.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.WaterSteam.PressureLosses.SingularPressureLoss singularPressureLoss4 annotation(Placement(transformation(x=50.0, y=-10.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.WaterSteam.PressureLosses.SingularPressureLoss singularPressureLoss5 annotation(Placement(transformation(x=50.0, y=-90.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante constante1(k=0) annotation(Placement(transformation(x=-30.0, y=-30.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.WaterSteam.BoundaryConditions.SinkP sinkP4 annotation(Placement(transformation(x=90.0, y=-50.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante constante2(k=0) annotation(Placement(transformation(x=-30.0, y=-70.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
equation
  connect(sourceP.C,singularPressureLoss.C1) annotation(Line(points={{-80,50},{-60,50}}, color={0,0,255}));
  connect(singularPressureLoss.C2,splitter2.Ce) annotation(Line(points={{-40,50},{-20,50}}, color={0,0,255}));
  connect(splitter2.Cs1,singularPressureLoss1.C1) annotation(Line(points={{-6,60},{-6,90},{40,90}}, color={0,0,255}));
  connect(singularPressureLoss1.C2,sinkP.C) annotation(Line(points={{60,90},{80,90}}, color={0,0,255}));
  connect(splitter2.Cs2,singularPressureLoss2.C1) annotation(Line(points={{-6,40},{-6,10},{40,10}}, color={0,0,255}));
  connect(singularPressureLoss2.C2,sinkP1.C) annotation(Line(points={{60,10},{80,10}}, color={0,0,255}));
  connect(constante.y,splitter2.Ialpha1) annotation(Line(points={{-19,70},{-14,70},{-14,56},{-9,56}}));
  connect(sourceP1.C,singularPressureLoss3.C1) annotation(Line(points={{-80,-50},{-60,-50}}, color={0,0,255}));
  connect(singularPressureLoss3.C2,splitter3.Ce) annotation(Line(points={{-40,-50},{-19.8,-50}}, color={0,0,255}));
  connect(splitter3.Cs1,singularPressureLoss4.C1) annotation(Line(points={{-6,-40},{-6,-10},{40,-10}}, color={0,0,255}));
  connect(singularPressureLoss4.C2,sinkP2.C) annotation(Line(points={{60,-10},{80,-10}}, color={0,0,255}));
  connect(splitter3.Cs2,singularPressureLoss5.C1) annotation(Line(points={{-6,-60},{-6,-90},{40,-90}}, color={0,0,255}));
  connect(singularPressureLoss5.C2,sinkP3.C) annotation(Line(points={{60,-90},{80,-90}}, color={0,0,255}));
  connect(constante1.y,splitter3.Ialpha1) annotation(Line(points={{-19,-30},{-14,-30},{-14,-44},{-9,-44}}));
  connect(splitter3.Cs3,sinkP4.C) annotation(Line(points={{0,-50},{80,-50}}, color={0,0,255}));
  connect(splitter3.Ialpha2,constante2.y) annotation(Line(points={{-9,-56},{-14,-56},{-14,-70},{-19,-70}}));
end TestJunctions;
